package 趋势科技20210821;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

/**
 @author fujiangnan
 @create 2021-08-21-18-29
 @desc ...
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String[] s1 = s.split(" ");
        String target = s1[0];
        String[] split = s1[1].split("\"");
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < split.length; i++) {
            if (split[i].equals("[") || "]".equals(split[i]) || split[i].equals(",")) {
                continue;
            } else {
                list.add(split[i]);
            }

        }
        String[] arr = list.toArray(new String[list.size()]);
        List<String> str = findStr(arr, target);
        for (String str1 :
                str) {
            System.out.print(str1);
            System.out.print(" ");
        }
        System.out.println("Not Match");
    }
    public static List<String> findStr(String[] arr, String target) {
        String[] split = target.split("\\.");
        if (split.length == 1 && "*".equals(split[0])) {
            return Arrays.asList(arr);
        }
        return Arrays.asList(arr);
    }
}
